﻿@model List<KRM.Web.Controllers.HomeController.SalesByProductResult>
<div class="small-scroll fixhead row-fluid">
    <table class="table table-bordered table-fix table-nohidden" id="tbSalesByProduct">
        <thead id="tbSalesByProducthead">
            <tr>
                @if (ViewBag.GroupByColumns.Contains("ProductID"))
                {
                    <th>ProductId</th>
                }
                                      
                @if (ViewBag.GroupByColumns.Contains("Product"))
                {
                    <th>Product</th>
                }
                @if (ViewBag.GroupByColumns.Contains("Disp"))
                {
                    <th>Disp</th>
                }
                @if (ViewBag.GroupByColumns.Contains("Store"))
                {
                    <th>Store</th>
                }
                @if (ViewBag.GroupByColumns.Contains("DepartmentName"))
                {
                    <th>DepartmentName</th>
                }
                @if (ViewBag.GroupByColumns.Contains("Supplier"))
                {
                    <th>Supplier</th>
                }                                        
                @if (ViewBag.GroupByColumns.Contains("ordered"))
                {
                    <th>Ordered</th>
                }                                       
                <th>SalesIncVAT</th> 
                <th>SalesExVAT</th> 
                <th>NumSold</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    @if (ViewBag.GroupByColumns.Contains("ProductID"))
                {
                    <td>@item.ProductID</td>
                }
                                      
                @if (ViewBag.GroupByColumns.Contains("Product"))
                {
                    <td>@item.Product</td>
                }
                @if (ViewBag.GroupByColumns.Contains("Disp"))
                {
                    <td>@item.Disp</td>
                }
                @if (ViewBag.GroupByColumns.Contains("Store"))
                {
                    <td>@item.Store</td>
                }
                @if (ViewBag.GroupByColumns.Contains("DepartmentName"))
                {
                    <td>@item.DepartmentName</td>
                }
                @if (ViewBag.GroupByColumns.Contains("Supplier"))
                {
                    <td>@item.Supplier</td>
                }                                        
                @if (ViewBag.GroupByColumns.Contains("ordered"))
                {
                    <td>@item.ordered</td>
                }
                <td>@item.SalesIncVAT</td> 
                    <td>@item.SalesExVAT</td> 
                    <td>@item.NumSold</td> 
                </tr>
            }
        </tbody>
    </table>
</div>
<div class="row-fluid" style="margin-top: 10px">
    <table class="table">
        <thead >
            <tr>
                <th></th>
                <th><b>ValueExVAT</b></th>
                <th><b>ValueIncVAT</b></th>
                <th><b>NumSold</b></th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td style="color: red">@ViewBag.lblInternet</td>
                <td>@ViewBag.lblInternetSalesExVAT</td>
                <td>@ViewBag.lblInternetSalesIncVAT</td>
                <td>@ViewBag.lblInternetNum</td>
            </tr>
            <tr>
                <td style="color: red">@ViewBag.lblPhone</td>
                <td>@ViewBag.lblPhoneSalesExVAT</td>
                <td>@ViewBag.lblPhoneSalesIncVAT</td>
                <td>@ViewBag.lblPhoneNum</td>
            </tr>
            <tr>
                <td style="color: red">@ViewBag.lblGoogle</td>
                <td>@ViewBag.lblGoogleSalesExVAT</td>
                <td>@ViewBag.lblGoogleSalesIncVAT</td>
                <td>@ViewBag.lblGoogleNum</td>
            </tr>
            <tr>
                <td style="color: red">@ViewBag.lblTrade</td>
                <td>@ViewBag.lblTradeSalesExVAT</td>
                <td>@ViewBag.lblTradeSalesIncVAT</td>
                <td>@ViewBag.lblTradeNum</td>
            </tr>
            <tr style="font-weight: bold">
                <td style="color: red">Total</td>
                <td>@ViewBag.lblTotalSalesExVAT</td>
                <td>@ViewBag.lblTotalSalesIncVAT</td>
                <td>@ViewBag.lblTotalNum</td>
            </tr>
        </tbody>
    </table>
</div>